package com.smartlifev30.baiwei.adapter;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.smartlifev30.baiwei.bean.ControlPage;

import java.util.ArrayList;

/**
 *
 * @author tys
 * @date 2018/8/15
 */

public class ControlFragmentAdapter extends FragmentPagerAdapter{
    private final ArrayList<ControlPage> data;

    public ControlFragmentAdapter(FragmentManager fragmentManager, ArrayList<ControlPage> fragments) {
        super(fragmentManager);
        this.data = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return data.get(position).getFragment();
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return data.get(position).getDescription();

    }

}
